#!/usr/bin/env python3
"""Unemployment Analysis Script
Author: Juan Moises de la Serna
"""
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv('unemployment_extended.csv')
print(df.groupby('country')['unemployment_rate_pct'].describe())

for country in df['country'].unique():
    sub = df[df['country'] == country]
    plt.plot(sub['year'], sub['unemployment_rate_pct'], marker='o', label=country)

plt.title('Unemployment Rates - Latin America')
plt.xlabel('Year')
plt.ylabel('Unemployment Rate (%)')
plt.legend()
plt.tight_layout()
plt.savefig('unemployment_trends.png', dpi=150)
